package com.lizardmind.haofudoctor.other

import android.os.Build
import com.blankj.utilcode.util.AppUtils
import okhttp3.Interceptor
import okhttp3.Response

/**
 * 向请求头添加一点信息
 * Created by Extends on 2017/10/27 11:49
 */
class HeadInfoInterceptor: Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        var request = chain.request()
        request = request.newBuilder()
                .addHeader("SYSTEM_VERSION","Android "+ Build.VERSION.RELEASE)
                .addHeader("PHONE_BRAND",Build.BRAND)
                .addHeader("PHONE_MODELS",Build.MODEL)
                .addHeader("ROM_VERSION",Build.VERSION.INCREMENTAL)
                .addHeader("SOFTWARE_VERSION",AppUtils.getAppVersionName())
                .build()
        val response = chain.proceed(request)
        return response
    }
}